package com.javastudy.a01staticdemo1;

public class studentText {
    public static void main(String[] args) {
        //被static修饰的成员变量,叫做静态变量

        //特点:
        //被该类所有对象共享
        //不属于对象,属于类。
        //随着类的加载而加载,优先于对象存在

       //调用方式:
       //类名调用(推荐)
       //对象名调用





        Student.teachername = "xxx";

        Student stu1 = new Student();
        stu1.setName("zhangsan");
        stu1.setAge(24);
        Student.teachername = "wanglaoshi";
        System.out.println(stu1);


        Student stu2 = new Student();
        stu2.setName("lisi");
        stu2.setAge(22);
        System.out.println(stu2);
    }
}
